const axios = require('axios');

// Test the server endpoints
async function testServer() {
  try {
    console.log('Testing Bailian API Server...');
    
    // Test status endpoint
    console.log('\nTesting /api/bailian/status endpoint:');
    const statusResponse = await axios.get('http://localhost:3000/api/bailian/status');
    console.log('Status:', statusResponse.data);
    
    // Test completion endpoint (uncomment and update with valid credentials)
    /*
    console.log('\nTesting /api/bailian/completion endpoint:');
    const completionResponse = await axios.post('http://localhost:3000/api/bailian/completion', {
      prompt: 'Once upon a time',
      maxTokens: 100,
      temperature: 0.7
    });
    console.log('Completion Response:', completionResponse.data);
    */
    
    // Test chat endpoint (uncomment and update with valid credentials)
    /*
    console.log('\nTesting /api/bailian/chat endpoint:');
    const chatResponse = await axios.post('http://localhost:3000/api/bailian/chat', {
      messages: [
        { role: 'user', content: 'Hello, how are you?' }
      ],
      maxTokens: 100,
      temperature: 0.7
    });
    console.log('Chat Response:', chatResponse.data);
    */
    
    console.log('\nAll tests completed!');
  } catch (error) {
    console.error('Test Error:', error.response?.data || error.message);
  }
}

// Run the tests
testServer();
